<?php // no direct access
defined('_JEXEC') or die('Restricted access'); ?>

<script type="text/javascript">
$(document).ready(function(){	
     reset_register=function(){
     //e.preventDefault(); 
	 //alert("aaaaaaa");
     $("#email").attr("value","");
     $("#name").attr("value","");
     $("#address").attr("value","");
     $("#firma").attr("value","");
	 $("#postnr").attr("value","");
	 $("#mobile").attr("value","");
	 $("#by").attr("value","");
	 $("#phonetable").attr("value","");
	 $("#username").attr("value","");
	 $("#password").attr("value","");
	 $("#password2").attr("value","");
     return false;
	 };
    });
</script>
<script type="text/javascript">
	$(document).ready(function(){
	
    check_register=function(){
        
        if(($('#firma').attr("value") == "" )){
            $('#alert').html('Udfyld venligst Firma');
            $('#backoverlay').show();
            $('#show_popup').show();
            $('#f_focus').html('firma');
            return false;	
        }
		
		if(($('#name').attr("value") == "" )){
            $('#alert').html('Udfyld venligst Kontaktperson');
            $('#backoverlay').show();
            $('#show_popup').show();
            $('#f_focus').html('name');
            return false;	
        }
		
		if(($('#address').attr("value") == "" )){
            $('#alert').html('Udfyld venligst Address');
            $('#backoverlay').show();
            $('#show_popup').show();
            $('#f_focus').html('address');
            return false;	
        }
		
		if(($('#postnr').attr("value") == "" )){
            $('#alert').html('Udfyld venligst Postnr.');
            $('#backoverlay').show();
            $('#show_popup').show();
            $('#f_focus').html('postnr');
            return false;	
        }
		
		if(isNaN($('#postnr').val())){
			$('#alert').html('Postnr eneste tal');
            $('#backoverlay').show();
			$('#show_popup').show();
			$('#f_focus').html('postnr');
			return false;	     
        }
		
		if(($('#by').attr("value") == "" )){
            $('#alert').html('Udfyld venligst By');
            $('#backoverlay').show();
            $('#show_popup').show();
            $('#f_focus').html('by');
            return false;	
        }
		
		if(($('#phonetable').attr("value") == "" )){
            $('#alert').html('Udfyld venligst Tlf.nr.');
            $('#backoverlay').show();
            $('#show_popup').show();
            $('#f_focus').html('phonetable');
            return false;	
        }
			
		if(isNaN($('#phonetable').val())){
			$('#alert').html('Tlf.nr. eneste tal');
            $('#backoverlay').show();
			$('#show_popup').show();
			$('#f_focus').html('phonetable');
			return false;	     
        }
		
		
        
        if(($('#email').attr("value") == "" )){
		//alert("aaaa");
            $('#alert').html('Udfyld venligst Email');
            $('#backoverlay').show();
            $('#show_popup').show();
            $('#f_focus').html('email');
            return false;	
        }
        
        else{
            if(!isEmail($('#email').val())){
                $('#alert').html('Venligst e-mail er gyldig');
                $('#backoverlay').show();
                $('#show_popup').show();
                $('#s_focus').html('email');
                return false; 
            }
        }
             	
		 if(($('#username').attr("value") == "" )){
            $('#alert').html('Udfyld venligst Brugernavn');
            $('#backoverlay').show();
            $('#show_popup').show();
            $('#f_focus').html('username');
            return false;	
        }
		
		 if(($('#password').attr("value") == "" )){
            $('#alert').html('Udfyld venligst Adgangskode');
            $('#backoverlay').show();
            $('#show_popup').show();
            $('#f_focus').html('password');
            return false;	
        }
				
		if(($('#password2').attr("value") == "" )){
            $('#alert').html('Udfyld venligst Bekræft adgangskode');
            $('#backoverlay').show();
            $('#show_popup').show();
            $('#f_focus').html('password2');
            return false;	
        }
		
		if($('#password').val()!=$('#password2').val()){
           $('#alert').html('Udfyld venligst Adgangskode');
            $('#backoverlay').show();
			$('#show_popup').show();
			$('#f_focus').html('password2');
			return false;
        }  
		
        $('#check_register').click();
        
        return true;
	};    
     isEmail=function(string) {
		if (string.search(/^\w+((-\w+)|(\.\w+)|(\_\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) != -1)
			return true;
		else return false;
    };
    close_popup=function(){		
		var fel=$('#f_focus').html();
        $('#backoverlay').hide();
		$('#show_popup').hide();
		$('#' + fel ).focus();
	};
    
    });

</script> 

<div id="main">
	<div id="content">
		<h1 class="page-title">OPRET EN KONTO</h1>
		<!-- Begin corporate structure  -->
		<div class="content-ctn grid-bg">
			<div id="accountContent">
				<form action="<?php echo JRoute::_( 'index.php?option=com_user' ); ?>" method="post" id="opretKontoForm" name="josForm">
					<fieldset>
						<!--Kunde infomation-->
						<div class="client-info block-decor fl-left">
							<div class="form-set-ctn">
								<h2>Konto infomation</h2>
								<div class="input-set">
									<label>Firma <span>*</span></label>
									<input type="text" value="<?php echo $this->escape($this->user->get( 'firma' ));?>" name="firma" id="firma" class="input-txt">
									<label id="namemsg" for="name">Kontaktperson <span>*</span></label>
									<input type="text" name="name" id="name" size="40" value="<?php echo $this->escape($this->user->get( 'name' ));?>" class="input-txt" maxlength="50" />
									<label>Adresse <span>*</span></label>
									<input type="text" value="<?php echo $this->escape($this->user->get( 'address' ));?>" name="address" id="address" class="input-txt">
									<label>Postnr. <span>*</span></label>
									<input type="text" value="<?php echo $this->escape($this->user->get( 'postnr' ));?>" name="postnr" id="postnr" class="input-txt post-num">
									<label class="city">By <span>*</span></label>
									<input type="text" value="<?php echo $this->escape($this->user->get( 'By' ));?>" name="by" id="by" class="city">
									<label>Tlf.nr. <span>*</span></label>
									<input type="text" value="<?php echo $this->escape($this->user->get( 'phonetable' ));?>" name="phonetable" id="phonetable" class="input-txt">
									<label>Mobil.nr.</label>
									<input type="text" value="<?php echo $this->escape($this->user->get( 'mobil' ));?>" name="mobil" id="mobil" class="input-txt">
									<label id="emailmsg" for="email">Email <span>*</span></label>									
									<input type="text" id="email" name="email" size="40" value="<?php echo $this->escape($this->user->get( 'email' ));?>" class="input-txt">
									<label id="VRnr" for="VRnr">CVR-nr.</label>
									<input type="text" value="<?php echo $this->escape($this->user->get( 'VRnr' ));?>" name="VRnr" id="VRnr" class="input-txt">
									<label id="usernamemsg" for="username">Brugernavn <span>*</span></label>
									<input type="text" id="username" name="username" size="40" value="<?php echo $this->escape($this->user->get( 'username' ));?>" class="input-txt" maxlength="25" />
									<label id="pwmsg" for="password">Adgangskode <span>*</span></label>
									<input class="input-txt" type="password" id="password" name="password"  value="" />
									<label id="pw2msg" for="password2">Bekræft adgangskode <span>*</span></label>
									<input class="input-txt" type="password" id="password2" name="password2" value="" /> 
									<p class="note fl-right">Elter markeret med <span>*</span> skal udfyldes</p>
								</div>
							</div>
						</div>
						<div class="form-submit">
							<a class="send-btn fl-left" onclick="check_register();" href="javascript:void(0);" >Send</a>
							<a class="reset-btn fl-left" onclick="reset_register();" href="javascript:void(0);">Nustil</a>
						</div>
					</fieldset>
					<button name="submit" id="check_register" type="submit" style="display:none"><?php echo JText::_('Register'); ?></button>
					<input type="hidden" name="task" value="register_save" />
					<input type="hidden" name="id" value="0" />
					<input type="hidden" name="gid" value="0" />
					<?php echo JHTML::_( 'form.token' ); ?>
				</form>
			</div>
		</div>                              
	</div>
  
</div>


